<?php

abstract class Notes extends Pdo2 {

		public static function getNote ($idClient){
			
			$sql = "SELECT texteNote, idNote
							FROM notes
							WHERE idClient = ".$idClient;
			
			$notes = Req::selectionner($sql);
			
			return $notes;
		}
	
		public static function ajoutNote($idClient,$texteNote) {
			
			$sql = "INSERT INTO notes
							VALUES (null, null, '".$texteNote."',$idClient)";
			
			$requeteReussie = Req::inserer($sql);
			
			echo $sql;
			
			return $requeteReussie;
		}
		
		public static function modifNote($idClient, $texteNote, $idNote) {
			
			$sql = "UPDATE notes
							SET texteNote = '$texteNote',
									 dateNote = null
							WHERE idClient = $idClient
							AND idNote = $idNote";
							
			$requetePreparee = Pdo2::getPdo()->prepare($sql);
			$requeteReussie = $requetePreparee->execute();
			
			return $requeteReussie;
			
		}
}